/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package networkrespnse;

import core.ParameterDecoder;
import utils.Utils;

/**
 *
 * @author Kvest
 */
public class GetCSBalanceAnswer extends Response
{
    private String sum;
    
    public GetCSBalanceAnswer(byte[] data)
    {
        super(CSBALANCE_RESPONSE);
        sum = "";
        
        parse(data);
    }
    
    protected void parse(byte[] data)
    {
        byte[] body = ParameterDecoder.getTransferBody(data);
        //������������� ��������
        byte[] temp = new byte[4];
        int index = 0;
        for (int i=0;i<4;i++)
        {
                temp[i] = body[index++];
        }
        index += Utils.byteToInt(temp);
        
        temp = new byte[4];
        for (int i=0;i<4;i++)
        {
            temp[i] = body[index++];
        }
        int  size = Utils.byteToInt(temp);
        temp = new byte[size];
        for (int i=0;i<size;i++)
        {
                temp[i] = body[index++];
        }
        sum = Utils.byteToString(temp);
    }

    public String getSum() 
    {
        return sum;
    }
}
